<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2019/1/28
 * Time: 18:12
 */
namespace common\sources\write\sendddcode;

use common\models\craftsman\SendDdCode;
use Yii;

class SendDdCodeAccess implements ISendDdCodeAccess
{
    public function sendDdCode($data)
    {
        return Yii::$app->db->createCommand()->insert('send_dd_code', [
            'phone' => $data['phone'],
            'code' => $data['code'],
            'status' => $data['status'],
            'operator' => isset($data['operator']) ? $data['operator'] : '' ,
            'create_time' => time()
        ])->execute();
    }

    public function delDdCodeById($ids)
    {
        return SendDdCode::deleteAll(['id' => $ids]);
        // TODO: Implement delDdCodeById() method.
    }
}